package com.pf.controller;

import com.pf.dto.BusinessReq;
import com.pf.dto.FileDTO;
import com.pf.dto.ResultResp;
import com.pf.service.BusinessFileService;
import com.pf.utils.ResultRespUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author PanFei
 * @version 1.0.0
 * @createTime 2022/7/1 23:14
 */
@RestController
@RequestMapping("/business")
public class BusinessFileController {

    @Autowired
    private BusinessFileService businessFileService;

    @PostMapping("/test")
    public ResultResp test(@RequestBody BusinessReq businessReq) throws Exception {
        businessFileService.operation(businessReq);
        return ResultRespUtils.success();
    }

    @GetMapping("/file/list/{businessCode}")
    public ResultResp<List<FileDTO>> getFileList(@PathVariable("businessCode") String businessCode) {
        return ResultRespUtils.success(businessFileService.getFileList(businessCode));
    }
}